﻿<%@ Page Title="About Us" Language="C#" MasterPageFile="AdminSite.master" AutoEventWireup="true"
    CodeFile="OptionSlideShow.aspx.cs" Inherits="OptionSlideShow" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
   
    <style type="text/css">
        .style1
        {
        }
        .style2
        {
            width: 494px;
        }
    </style>
    <script type="text/javascript">
        function newSlide() {
            ddLoaiBVSlide.value = "-1";
            txtURLSlide.value = "";
            txtSapXepSlide.value = "";
            lblNgayTaoSlide.value = "";
            keySlide.value = "";
            imageSlide.src = '../images/web/transparent.png';
            btnSaveSlideShow.value = "Lưu slide show";
            $("#ddlBVSlide").empty();
            var opt = document.createElement("option");
            ddlBVSlide.options.add(opt);
            opt.text = "[Chưa có dữ liệu]";
            opt.value = "-1";
            ddlBVSlide.value = "-1";

        }
   
    </script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2 align="center">
        TÙY CHỌN 
        ẢNH SLIDE SHOW</h2>
    <asp:UpdatePanel runat="server" ID="updatepanel1">
        <ContentTemplate>

                <div class="slidingDiv1">
                    <table width="100%">
                        <tr>
                            <td>
                                <table width="100%">
                                   <tr>
                                        <td class="style1" colspan="3" valign="top">
                                            <asp:ValidationSummary ID="VanPhongValidationSummary" runat="server" 
                                                CssClass="failureNotification" ValidationGroup="DetailValidationGroup" />
                                        </td>
                                       
                                    </tr>
                                    <tr>
                                        <td class="style1" colspan="2" valign="top">
                                            &nbsp;</td>
                                        <td align="center" rowspan="8">
                                            <asp:Image ID="imageSlide" ClientIDMode="Static" runat="server" Height="203px" Width="209px"
                                                BorderStyle="Solid" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style1" colspan="2" valign="top">
                                            Chọn đường dẫn từ bài viết:
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style1" valign="top">
                                            &nbsp;&nbsp;&nbsp; - Loại bài biết:
                                        </td>
                                        <td class="style2">
                                            <asp:DropDownList ID="ddLoaiBVSlide" ClientIDMode="Static" runat="server" Height="23px"
                                                Width="464px" AutoPostBack="true" OnSelectedIndexChanged="ddLoaiBVSlide_SelectedIndexChanged">
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style1">
                                            &nbsp;&nbsp;&nbsp; - Bài biết:
                                        </td>
                                        <td class="style2">
                                            <asp:DropDownList ID="ddlBVSlide" ClientIDMode="Static" runat="server" Height="23px"
                                                Width="464px" OnSelectedIndexChanged="ddlBVSlide_SelectedIndexChanged" AutoPostBack="true">
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style1">
                                            Hoặc nhập 1 đường dẫn:
                                        </td>
                                        <td class="style2">
                                            <asp:TextBox ID="txtURLSlide" ClientIDMode="Static" runat="server" Height="23px"
                                                Width="463px"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style1">
                                            Chọn ảnh (610px X 350px):
                                        </td>
                                        <td class="style2">
                                            <asp:FileUpload ID="uploadSlide" runat="server" Width="458px" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style1">
                                            Sắp xếp:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtSapXepSlide" ClientIDMode="Static" runat="server" Height="23px"
                                                Width="143px"></asp:TextBox><asp:RegularExpressionValidator ID="GiaVeFieldValidator1" runat="server" ControlToValidate="txtSapXepSlide"
                                                CssClass="failureNotification" ErrorMessage="Sắp xếp phải là số" ValidationExpression="^\d+$"
                                                ToolTip="Vui lòng nhập sắp xếp dạng số" ValidationGroup="DetailValidationGroup">*</asp:RegularExpressionValidator>
                                            &nbsp;Ngày Tạo:<asp:Label ID="lblNgayTaoSlide" ClientIDMode="Static" runat="server"></asp:Label>
                                            
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style1">
                                            &nbsp;
                                        </td>
                                        <td class="style2">
                                            &nbsp;
                                            <asp:CheckBox ID="ckcHiden" runat="server" ClientIDMode="Static" Text="Ẩn (không sử dụng)" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3" align="center">
                                            <asp:Button ID="btnSaveSlideShow" ClientIDMode="Static" runat="server" CssClass="btnadmin"
                                                Text="Lưu slide show" Width="115px" ValidationGroup="DetailValidationGroup" OnClick="btnSaveSlideShow_Click" />
                                            <input type="button" id="btnNewSlide" onclick="newSlide()" value="Thêm mới" class="btnadmin" />
                                            <asp:HiddenField ID="keySlide" ClientIDMode="Static" runat="server" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:GridView ID="gridViewSlideShow" CssClass="grid-view" runat="server" CellPadding="3"
                                    Width="100%" AutoGenerateColumns="False" GridLines="Vertical" ShowHeaderWhenEmpty="True"
                                    OnRowCommand="gridViewSlideShow_RowCommand" OnRowDataBound="gridViewSlideShow_RowDataBound"
                                >
                                    <Columns>
                                        <asp:ButtonField Text="Sửa" CommandName="cmdEdit">
                                            <ControlStyle Font-Underline="True" />
                                        </asp:ButtonField>
                                        <asp:ButtonField Text="Xóa" CommandName="cmdDelete">
                                            <ControlStyle Font-Underline="True" />
                                        </asp:ButtonField>
                                        <asp:TemplateField HeaderText="Ẩn">
                                            <ItemTemplate>
                                                <asp:CheckBox ID="ckcGridHiden" runat="server" OnCheckedChanged="ckcGridHiden_CheckedChanged"
                                                    AutoPostBack="true" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:ImageButton ID="imgBtnUp" runat="server" 
                                                    ImageUrl="../images/web/move_up.png" ImageAlign="Middle" OnClick="imgBtnUp_CheckedChanged" />
                                                    <br />
                                                    <br />
                                                 <asp:ImageButton ID="imgBtnDow" runat="server" 
                                                    ImageUrl="../images/web/move_down.png" ImageAlign="Middle" OnClick="imgBtnDown_CheckedChanged" />
                                            </ItemTemplate>                                      
                                        </asp:TemplateField>
                                        <asp:BoundField HeaderText="STT" DataField="STT">
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="ẢNH">
                                            <ItemTemplate>
                                                <asp:Image ID="img_first" runat="server" Width="100px" Height="100px" BorderStyle="Solid" BorderWidth="1px"
                                                    ImageUrl='<%# Eval("URL_IMAGE")%>' /></a>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="SAP_XEP" HeaderText="SẮP XẾP" />
                                        <asp:TemplateField HeaderText="ĐƯỜNG DẪN" ControlStyle-Width="160px">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="linkbtn" runat="server" PostBackUrl='<%# Eval("URL_LINK")%>'
                                                    Text='<%# Eval("TEN_BAI_VIET")%>'></asp:LinkButton>
                                            </ItemTemplate>
                                            <ControlStyle Width="160px" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="NGAY_TAO" DataFormatString="{0:dd/MM/yyyy HH:mm}" HeaderText="NGÀY TẠO" />
                                    </Columns>
                                    <FooterStyle CssClass="gridfooter" />
                                    <HeaderStyle CssClass="gridheader" />
                                    <PagerStyle CssClass="gridpager" />
                                    <RowStyle CssClass="gridrownormal" />
                                    <AlternatingRowStyle CssClass="gridrowalternate" />
                                    <SelectedRowStyle CssClass="gridselected" />
                                    <SortedAscendingCellStyle CssClass="gridrowsortasc" />
                                    <SortedAscendingHeaderStyle CssClass="gridheadersortasc" />
                                    <SortedDescendingCellStyle CssClass="gridrowsortdesc" />
                                    <SortedDescendingHeaderStyle CssClass="gridheadersortdesc" />
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </div>
    
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnSaveSlideShow" />
        </Triggers>
    </asp:UpdatePanel>
    
</asp:Content>
